# attempts to get the screen geometry
S03systemsplash_geometry() {
    geometry=$(batocera-resolution currentMode | sed -E 's/[0-9]+\.[0-9]+\.([0-9]+)x([0-9]+)\..*/\1 \2 \1 \2 32/')
}

# try a few times to get the geometry
geometry=""; count=0

S03systemsplash_geometry
while [ $(expr "$geometry" : '[[:digit:]]\+ [[:digit:]]\+ [[:digit:]]\+ [[:digit:]]\+ 32') -eq 0 ]; do
    echo "Waiting"
    sleep 0.5
    S03systemsplash_geometry
    count=$((count+1))
    [ count -eq 6 ] && geometry="1920 1080 1920 1080 32" # take a guess
done
fbset -a -g $geometry
